{extend name="$member_admin_layout" /}
{block name="style"}
{/block}
{block name="content"}
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import Vue before Element -->
    <script src="/static/plugins/vue/vue.min.js"></script>
    <!-- import element ui  -->
    <!-- import JavaScript -->
    <script src="/static/plugins/element-ui/element-ui.js" ></script>
    <!-- import CSS -->
    <link rel="stylesheet" href="/static/plugins/element-ui/element-ui.css">
    <!-- import element ui  -->
    <script src="/static/plugins/echarts/echarts.min.js"></script>
    <!-- ajax请求 -->
    <script src="/static/plugins/ajax/axios.js" ></script>
    <link rel="stylesheet" href="/static/plugins/wang-editor/css/wangEditor.min.css?v=12221">
    <script src="/static/plugins/wang-editor/js/wangEditor.min.js?v=12111"></script>
    <!-- layui css -->
    <script src="/static/admin/js/layui/layui.all.js"></script>
    <!-- layui css -->
    <link rel="stylesheet" href="/static/admin/js/layui/css/layui.css">

</head>
<body>
<div id="app" class="app">

    <el-card class="box-card">
        <div slot="header" class="clearfix">
            <span  style="color:#409EFF;font-size:16px;">{:lang('批量盘点')}</span>
        </div>


        <div>

            <el-form id="goodsform"  label-width="150px" label-position="right" class="demo-ruleForm " >
                <el-row sapn='12'>
                    <span>1、先下载盘点单模板</span>
                </el-row>

                <el-row sapn='12'>
                    <el-col span="7">
                        <el-form-item label="{:lang('盘点仓库')}：" >
                            <el-select  filterable  name="warehouse_id" v-model='warehouse_id' placeholder="请选择" ref="optionRef">
                                <el-option
                                        v-for="item in warehouseData"
                                        :key="item.aid"
                                        :label="item.name"
                                        :value="item.aid">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col >

                    <el-col span="7">
                        <el-form-item label="{:lang('分类')}：" style="margin-bottom:5px;important!">
                            <el-select  placeholder="请选择"  name="goodscate_id" filterable  v-model='goodscate_id' ref="optionRef" >
                                <el-option
                                        v-for="item in category"
                                        :key="item.id"
                                        :label="item.fenleiming"
                                        :value="item.id">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col >

                    <el-col span="7">
                        <el-form-item label="{:lang('上架下架')}：" >
                            <el-select  placeholder="请选择" filterable  name="status_id" v-model='status_id' placeholder="请选择">
                                <el-option
                                        v-for="item in status"
                                        :key="item.aid"
                                        :label="item.name"
                                        :value="item.aid">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col >

                    <!--<el-col span="7">-->
                    <!--       <el-form-item label="{:lang('数量')}："   prop='number' >-->
                    <!--              <el-input  type="number" name="number"  v-model='number' class="box-width" oninput="if(value<0)value=0"></el-input>-->
                    <!--        </el-form-item>-->
                    <!--</el-col >-->

                    <!--<el-col span="12">-->
                    <!--    <el-form-item label="{:lang('备注')}：" >-->
                    <!--        <el-input  type="text" name="remarks" v-model='remarks' class="box-width" ></el-input>-->
                    <!--    </el-form-item>-->
                    <!--</el-col >-->

                </el-row>

                <el-form-item>
                    <el-button type="primary"  class="btn btn-primary btn-flat"  @click="onSubmit"  type="submit">{:lang('导出')}</el-button>
                    <el-button class="btn btn-default btn-flat" @click='closelayer' >{:lang('取消')}</el-button>
                </el-form-item>

            </el-form>

        </div>

    </el-card>


</div>
</body>

<script>


    // const cityOptions = [];
    // const warehouseData = [];

    var vm = new Vue({
        el: '#app',
        data: function() {
            return {
                warehouse_id:'',
                warehouseData:[],
                category:[],
                goodscate_id:'',
                status_id:'',
                status:[{
                    aid: '1',
                    name: '上架'
                }, {
                    aid: '2',
                    name: '下架'
                }]
            }
        },

        mounted(){
            this.getAccount()
            this.getCategory()
        },

        methods:{
            getAccount(){
                let that = this
                // $.get('{:url("automatic/m" . MemberID . ".goodslist/getWarehouse")}',function(data,status){
                //     if(data.code == 1){
                //         that.warehouseData = data.data
                //     }
                // })

                axios.post('{:url("automatic/m" . MemberID . ".Goodslist/getWarehouse")}', {})
                    .then(function (response) {
                        that.warehouseData = response.data.data;
                    })
                    .catch(function (response) {

                    });
            },
            getCategory(){
                let that = this;
                axios.post('{:url("automatic/m" . MemberID . ".Goodslist/getCategory")}', {})
                    .then(function (response) {
                        that.category = response.data.data;
                    })
                    .catch(function (response) {

                    });
            },

            onSubmit(){
                let that = this

                var url = '';

                url = '{:url("automatic/m4054.goodslist/pandian_export")}' + '?warehouse_id=' + this.warehouse_id + '&goodscate_id=' + this.goodscate_id
                    + '&status_id=' + this.status_id;
                console.log(url);
                return false;
                $.post('{:url("automatic/m" . MemberID . ".goodslist/pandian_export")}',{warehouse_id:this.warehouse_id,goodscate_id:this.goodscate_id,status_id:this.status_id},function(res){
                    if(res.code == 1){
                        that.$message({
                            message: res.msg,
                            type: 'success',
                            onClose:()=>{

                                // parent.location.reload()
                                //  var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                                //   parent.layer.close(index);
                            }
                        });
                    }else{
                        that.$message({
                            message: res.msg,
                            type: 'warning'
                        });
                    }
                })
            },

            closelayer(){
                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                parent.layer.close(index);
            },

            oninputPrice(num) {
                var str = num
                var len1 = str.substr(0, 1)
                var len2 = str.substr(1, 1)
                // 如果第一位是0，第二位不是点，就用数字把点替换掉
                if (str.length > 1 && len1 == 0 && len2 != '.') {
                    str = str.substr(1, 1)
                }
                // 第一位不能是.
                if (len1 == '.') {
                    str = ''
                }
                // 限制只能输入一个小数点
                if (str.indexOf('.') != -1) {
                    var str_ = str.substr(str.indexOf('.') + 1)
                }
            }


        },

    })


</script>
</html>


{/block}
